    package com.example.glgk.optionenum;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

    @Getter
    @AllArgsConstructor
    public enum IndicatorType implements OptionsEnum {
        GL_GK_A("GL_GK_A","医疗质量相关指标"),
        GL_GK_B("GL_GK_B","运营效率相关指标"),
        GL_GK_C("GL_GK_C","持续发展相关指标"),
        GL_GK_D("GL_GK_D","满意度评价相关指标"),
        GL_GK_E("GL_GK_E","新增指标"),
        GL_GK_F("GL_GK_F","通用指标");

        private String value;
        private String text;
        private Integer order;

        IndicatorType(String value, String text) {
            this.value = value;
            this.text = text;
            // 未指定顺序就排在最后
            order = Integer.MAX_VALUE;
        }

        public static IndicatorType getEnumByText(String text) {
            IndicatorType[] arr = values();
            int len = arr.length;

            for (int i = 0; i < len; ++i) {
                IndicatorType simpleEnum = arr[i];
                if (simpleEnum.getText().equals(text)) {
                    return simpleEnum;
                }
            }
            return null;
        }

        public static IndicatorType getEnumByValue(String value) {
            IndicatorType[] arr = values();
            int len = arr.length;

            for (int i = 0; i < len; ++i) {
                IndicatorType simpleEnum = arr[i];
                if (simpleEnum.getValue().equals(value)) {
                    return simpleEnum;
                }
            }
            return null;
        }
    }
